package com.aaa.tars.controller;

import com.aaa.tars.entity.Sale;
import com.aaa.tars.service.SaleService;
import com.aaa.tars.util.Page;
import com.aaa.tars.util.Result;
import com.aaa.tars.util.ResultUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @FileName: SaleController
 * @Description:
 * @Author: ghz
 * @CreateTime:2025/9/9 15:30
 * @Version:1.0.0
 */
@RestController
@RequestMapping("sale")
public class SaleController {
    @Resource
    private SaleService saleService;
    @GetMapping("queryById")
    public Result queryById(Integer saleId){
        return ResultUtil.success(this.saleService.queryById(saleId));
    }

    @PostMapping("queryByPage")
    public Result queryByPage(@RequestBody Page<Sale> page){
        return ResultUtil.success(this.saleService.queryByPage(page));
    }
    @PutMapping("update")
    public Result update(@RequestBody Sale sale){
        return ResultUtil.success(this.saleService.update(sale));
    }

    @PostMapping("insert")
    public Result insert(@RequestBody Sale sale){
        return ResultUtil.success(this.saleService.insert(sale));
    }
    @DeleteMapping("deleteById")
    public Result deleteById(Integer saleId){
        return ResultUtil.success(this.saleService.deleteById(saleId));
    }

}
